package com.fbs.wowo.manage.mapper;

import com.fbs.wowo.manage.entity.UserLogin;
import org.apache.ibatis.jdbc.SQL;

public class UserLoginSqlProvider {

    public String insertSelective(UserLogin record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("user_login");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.VALUES("user_id", "#{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getTel() != null) {
            sql.VALUES("tel", "#{tel,jdbcType=VARCHAR}");
        }
        
        if (record.getVerifyCode() != null) {
            sql.VALUES("verify_code", "#{verifyCode,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getIsReg() != null) {
            sql.VALUES("is_reg", "#{isReg,jdbcType=TINYINT}");
        }
        
        if (record.getLoginType() != null) {
            sql.VALUES("login_type", "#{loginType,jdbcType=TINYINT}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("status", "#{status,jdbcType=TINYINT}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(UserLogin record) {
        SQL sql = new SQL();
        sql.UPDATE("user_login");
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getTel() != null) {
            sql.SET("tel = #{tel,jdbcType=VARCHAR}");
        }
        
        if (record.getVerifyCode() != null) {
            sql.SET("verify_code = #{verifyCode,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getIsReg() != null) {
            sql.SET("is_reg = #{isReg,jdbcType=TINYINT}");
        }
        
        if (record.getLoginType() != null) {
            sql.SET("login_type = #{loginType,jdbcType=TINYINT}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("status = #{status,jdbcType=TINYINT}");
        }
        
        sql.WHERE("id = #{id,jdbcType=VARCHAR}");
        
        return sql.toString();
    }
}